<%
Dim conn
Dim rs
Dim SQL
Dim uid
Dim getOld
uid=request.form.item("uid")
fuid=request.QueryString("fuid")
IF NOT fuid = "" Then
uid=fuid
End if
set conn = Server.Createobject("ADODB.Connection")
set  rs = Server.Createobject("ADODB.Recordset")
ConnStr = "DSN=dbpr_sql;UID=sa;PWD=hhhhhhhh;"
conn.Mode = 3
conn.Open (ConnStr)
if not len(uid) > 0 then
SQL="SELECT * FROM " & "BUYREC ORDER BY  "
Set rs = conn.Execute(SQL)
If rs.EOF Or rs.BOF Then
 response.Write ("<link rel='stylesheet' type='text/css' href='../Css/main.css'>")
  response.Write ("<body bgcolor='#ECE9D8'>")
   response.Write ("<b>No records found</b>")
 response.Write ("</body>")
 response.end
End If
uid = rs.Fields("").Value
Else
SQLx="SELECT * FROM " & "BUYREC ORDER BY  "
SQL="SELECT * FROM " & "BUYREC WHERE  = " & uid
End if
%>

<html>

<head>

<title>...</title>

<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>

</head>

<link rel="stylesheet" type="text/css" href="../Css/main.css">
<SCRIPT LANGUAGE=javascript>
function button_over(b)
{
b.style.backgroundColor = '#B5BDD6';
b.style.borderColor = 'darkblue darkblue darkblue darkblue';
}
function button_out(b)
{
b.style.backgroundColor = 'threedface';
b.style.borderColor = 'threedface';
}
function button_down(b)
{
b.style.backgroundColor = '#8494B5';
b.style.borderColor = 'darkblue darkblue darkblue darkblue';
}
function button_up(b)
{
b.style.backgroundColor = '#B5BDD6';
b.style.borderColor = 'darkblue darkblue darkblue darkblue';
b = null;
}


function checkdel() {
if (!confirm('Do you really want to delete this record ?'))
return(false);
}

function readall() {
}
</SCRIPT>




<body bgcolor='#ECE9D8'>

<table width=100% border=1 cellpadding=0 cellspacing=0 bordercolor='#000000' background='../imgsys/x.gif' bgcolor='#003366'>
  <tr> 
    <td valign=top align=center> <table width=100% border=0 cellspacing=0 cellpadding=0>
        <tr> 
          <td width='640' align=left><font color='#FFFFFF'><img src='../imgsys/edit2.gif' width='21' height='18' border='0'>&nbsp;<strong>&nbsp;EDIT 
            BUYREC</strong></font></td>
          <td width='640' align=center>&nbsp; </td>
          <td width='10' align=left bgcolor='#F0F2E6'><img src='../imgsys/bar.gif' width='13' height='18' border='0'></td>
          <td width='30' align=left bgcolor='#F0F2E6'><a href='UPD_BUYREC1.asp'><img src='../imgsys/edit.gif' alt='Edit data' width='21' height='18' border='0'></a></td>
          <td width='30' align=left bgcolor='#F0F2E6'><a href='INS_BUYREC1.asp'><img src='../imgsys/add.gif' alt='Add data' width='21' height='18' border='0'></a></td>
          <td width='30' align=left bgcolor='#F0F2E6'><a href="javascript:frm_search.uid.focus();"><img src='../imgsys/search.gif' alt='Search data' width='21' height='18' border='0'></a></td>
          <td width='10' align=left bgcolor='#F0F2E6'><img src='../imgsys/bar.gif' width='13' height='18' border='0'></td>
          <td width='30' align=center bgcolor='#F0F2E6'><a href='javascript:history.go(0)'><img src='../imgsys/refresh.gif' alt='Refresh' width='21' height='18' border='0'></a></td>
          <td width='30' align=center bgcolor='#F0F2E6'><a href='javascript:window.print();'><img src='../imgsys/printerbar.gif' alt='Print' width='19' height='20' border='0'></a></td>
          <td width='20' align=left bgcolor='#F0F2E6'><img src='../imgsys/bar.gif' width='13' height='18' border='0'></td>
          <td width='30' align=left bgcolor='#F0F2E6'><a href='javascript:window.location.href="right.htm"'><img src='../imgsys/close.gif' alt='Close form' width='15' height='16' border='0'></a></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width=100% border=1 cellspacing=0 cellpadding=0 bordercolor=#000000>

<tr>

<td>

<table width=100% border=0 cellspacing=0 cellpadding=0>

<tr bgcolor='#DEE2CB'> 

<td>&nbsp;</td>

<td width='98%'> 

<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#F0F2E6>

<Form name=frm method=POST action=UPD_BUYREC2.asp>

<BR>

<%
if uid = "" then
RESPONSE.WRITE("<input type=hidden name=xuid value=1>" & vbCrLf  )
Else
RESPONSE.WRITE("<input type=hidden name=xuid value=" & uid & ">" & vbCrLf  )
End if
ON ERROR RESUME NEXT

Dim Get_Value

set rs = conn.execute(SQL)
%>
<tr> 

<td align=right valign=top><br><b>recept : </b>&nbsp;<img src='../imgsys/arrowt.gif' width='14' height='14'></td>

<td align=center valign=top><br>

<%
'*****************************************************'
'           --  START CREATE SET RELATIONSHIP   --    '
'                                                     '
'*****************************************************'

Dim conn1
Dim rs1
set conn1 = Server.Createobject("ADODB.Connection")
set  rs1 = Server.Createobject("ADODB.Recordset")
ConnStr1 = "DSN=dbpr_sql;UID=sa;PWD=hhhhhhhh;"
conn1.Mode = 3
conn1.Open (ConnStr1)
SQL1 = "SELECT * FROM BUYREC WHERE  = " & uid
set rs1 = conn1.execute(SQL1)
getOld = rs1.Fields("RF_REC_ID").value
SQL1 = "SELECT * FROM REC"
set rs1 = conn1.execute(SQL1)
%>
<select name=F_RF_REC_ID>
<%
Do While Not rs1.EOF
IF CLng(rs1.fields("ID").value) = CLng(getOld) Then
RESPONSE.WRITE("<option value=" & rs1.Fields("ID").value & " selected>" & rs1.Fields("ID").value & "</option>")
Else
RESPONSE.WRITE("<option value=" & rs1.Fields("ID").value & ">" & rs1.Fields("ID").value & "</option>")
End if
rs1.MoveNext
Loop
%>
</select>
<%
conn1.close
set rs1 = Nothing
set conn1 = Nothing

'*****************************************************'
'           --  END CREATE  SET RELATIONSHIP    --    '
'                                                     '
'*****************************************************'

%>
</td>

</tr>

<% Get_Value = rs.Fields("CODE").value %>
<tr> 

<td align=right valign=top><br><b>CODE : </b>&nbsp;<img src='../imgsys/arrowt.gif' width='14' height='14'></td>

<td align=center valign=top><br><Input type=text name=F_CODE value='<%=Get_Value%>' size='98'></td>

</tr>

<tr> 

<td align=right valign=top><br><b>customer : </b>&nbsp;<img src='../imgsys/arrowt.gif' width='14' height='14'></td>

<td align=center valign=top><br>

<%
'*****************************************************'
'           --  START CREATE SET RELATIONSHIP   --    '
'                                                     '
'*****************************************************'

Dim conn3
Dim rs3
set conn3 = Server.Createobject("ADODB.Connection")
set  rs3 = Server.Createobject("ADODB.Recordset")
ConnStr3 = "DSN=dbpr_sql;UID=sa;PWD=hhhhhhhh;"
conn3.Mode = 3
conn3.Open (ConnStr3)
SQL3 = "SELECT * FROM BUYREC WHERE  = " & uid
set rs3 = conn3.execute(SQL3)
getOld = rs3.Fields("RF_CUSTOMER_ID").value
SQL3 = "SELECT * FROM CUSTOMER"
set rs3 = conn3.execute(SQL3)
%>
<select name=F_RF_CUSTOMER_ID>
<%
Do While Not rs3.EOF
IF CLng(rs3.fields("ID").value) = CLng(getOld) Then
RESPONSE.WRITE("<option value=" & rs3.Fields("ID").value & " selected>" & rs3.Fields("CODE").value & "</option>")
Else
RESPONSE.WRITE("<option value=" & rs3.Fields("ID").value & ">" & rs3.Fields("CODE").value & "</option>")
End if
rs3.MoveNext
Loop
%>
</select>
<%
conn3.close
set rs3 = Nothing
set conn3 = Nothing

'*****************************************************'
'           --  END CREATE  SET RELATIONSHIP    --    '
'                                                     '
'*****************************************************'

%>
</td>

</tr>

<tr> 

<td align=right valign=top><br><b>ware house : </b>&nbsp;<img src='../imgsys/arrowt.gif' width='14' height='14'></td>

<td align=center valign=top><br>

<%
'*****************************************************'
'           --  START CREATE SET RELATIONSHIP   --    '
'                                                     '
'*****************************************************'

Dim conn4
Dim rs4
set conn4 = Server.Createobject("ADODB.Connection")
set  rs4 = Server.Createobject("ADODB.Recordset")
ConnStr4 = "DSN=dbpr_sql;UID=sa;PWD=hhhhhhhh;"
conn4.Mode = 3
conn4.Open (ConnStr4)
SQL4 = "SELECT * FROM BUYREC WHERE  = " & uid
set rs4 = conn4.execute(SQL4)
getOld = rs4.Fields("RF_WHOUSE_ID").value
SQL4 = "SELECT * FROM WAREHOUSE"
set rs4 = conn4.execute(SQL4)
%>
<select name=F_RF_WHOUSE_ID>
<%
Do While Not rs4.EOF
IF CLng(rs4.fields("ID").value) = CLng(getOld) Then
RESPONSE.WRITE("<option value=" & rs4.Fields("ID").value & " selected>" & rs4.Fields("CODE").value & "</option>")
Else
RESPONSE.WRITE("<option value=" & rs4.Fields("ID").value & ">" & rs4.Fields("CODE").value & "</option>")
End if
rs4.MoveNext
Loop
%>
</select>
<%
conn4.close
set rs4 = Nothing
set conn4 = Nothing

'*****************************************************'
'           --  END CREATE  SET RELATIONSHIP    --    '
'                                                     '
'*****************************************************'

%>
</td>

</tr>

<tr>

<td align=right valign=top>

<P>&nbsp;</P>

<P>&nbsp;</P>

</td>

<td align=center valign=top>

<P>&nbsp;</P>

<input type=submit name=submit value='Delete all data' class='submit' onClick='javascript: return checkdel()'>

<input type=submit name=submit value='Save all data' class='submit' onClick='javascript: return readall()'>

<P>&nbsp;</P>

</td>

</tr>

</Form>

</table>

</td>

<td width=1%"&">&nbsp;</td>

</tr>

<tr bgcolor='#DEE2CB'> 

<td width=1%"&">&nbsp;</td>

<td width=98%"&">&nbsp;</td>

<td width=1%"&">&nbsp;</td>

</tr>

</table>

</td>

</tr>

</table>

<br>

<Form method=POST name='frm_search' action=UPD_BUYREC1.asp>

<table width='33%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td background='../imgsys/search_skin.gif' bgcolor='#EEEEEE'><font color='#000000'><b>&nbsp;Search by &nbsp;</b></font></td>
<td><img src='../imgsys/ang.gif' width='17' height='17'></td>
</tr>
</table>
<table width=100% border=1 cellspacing=0 cellpadding=0 bordercolor=#000000 background='../imgsys/x.gif' bgcolor='#DEE2CB'>

<tr>

<td valign=top align=center>

<table width=50% border=0 cellspacing=0 cellpadding=0>

<tr>

<td align=center>

<select name=uid>

<%
if uid = "" then
set rs = conn.execute(SQL)
Else
set rs = conn.execute(SQLx)
End if
ON ERROR RESUME NEXT

Do While Not rs.EOF
IF CLng(rs.fields("").value) = CLng(uid) Then
RESPONSE.WRITE("<option value=" & rs.fields("").value & " selected>" & rs.fields("").value  & "</option>" & vbCrLf  )
Else
RESPONSE.WRITE("<option value=" & rs.fields("").value & ">" & rs.fields("").value  & "</option>" & vbCrLf  )
End If
rs.MoveNext
Loop
conn.close
set rs = Nothing
set conn = Nothing
%>
</select>

</td>

<td>

<input type=submit name=Submit class='submit' value='Search'>

</td>

</tr>

</table>

</td>

</tr>

</table>

<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td align=right>
<a href='http://www.codejay.com' class='codejay' target='_blank'>powered by codejay</a>
</td>
</tr>
</table>

</Form>
</body>
</html>

